package demo1224.homework;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

//3.使用FileReader对象读取D:\a.txt文件中的内容,打印在控制台.
public class Demo3 {
    public static void main(String[] args) {

        try {
            FileReader fr = new FileReader(new File("D:\\a.txt"));

            int read;
            while((read=fr.read())!=-1){
                System.out.print((char)read);
            }
            fr.close();


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
